﻿using MediatR;
using Microsoft.AspNetCore.Mvc;
using SmartProduction.Domain.ProductionOrders;
using SmartProduction.ErrorCode;
using SmartProduction.Read.API.Application.Commands.ItemListInfoCommand;
using SmartProduction.Read.API.Application.Commands.ProductionOrderNoInfoCommand;

namespace SmartProduction.Read.API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProductionOrderNoInfoQueryController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProductionOrderNoInfoQueryController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 生产单号显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("ProductionOrderNoInfoQuery")]
        public async Task<APIPaing<List<ProductionOrderNoInfo>>> ProductionOrderNoInfoQuery([FromQuery]ProductionOrderNoInfoQueryCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 物品列表显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet("ItemListInfoQuery")]
        public async Task<APIPaing<List<ItemListInfo>>> ItemListInfoQuery([FromQuery] ItemListInfoQueryCommand request)
        {
            try
            {

                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
